package com.zealfi.wk.feign.controller;

import com.zealfi.wk.api.pojo.User;
import com.zealfi.wk.feign.service.FeignHelloService;
import com.zealfi.wk.feign.service.RefactorHelloService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by kuan at 2018-04-23 下午 4:44
 */
@RestController
public class ConsumerController {

    @Autowired
    private FeignHelloService feignHelloService;
    @Autowired
    private RefactorHelloService refactorHelloService;

    @RequestMapping("consume")
    public String consume() {
        return feignHelloService.hello();
    }

    @RequestMapping("consume2")
    public String consume2() {
        return feignHelloService.hello() + '\n' +
                feignHelloService.hello("宽") + '\n' +
                feignHelloService.hello(new User("小莉", 18)) + '\n' +
                feignHelloService.hello("拉拉", 20) + '\n';
    }

    @RequestMapping("consume3")
    public String consume3() {
        return refactorHelloService.hello() + '\n' +
                refactorHelloService.hello("宽") + '\n' +
                refactorHelloService.hello(new User("小莉", 18)) + '\n' +
                refactorHelloService.hello("拉拉", 20) + '\n';
    }

}
